<?php
class CategoryAction extends AdminBaseAction {
    protected $workground='content';
	protected $dao;
	public function _initialize(){
        parent::_initialize();
        parent::getSubMenu($this->workground);
		$this->assign('module','Category');
		$this->dao=M(MODULE_NAME)?M(MODULE_NAME):D(MODULE_NAME);
    }

    public function index(){
        $result=$this->dao->select();
        import('ORG.Util.Tree');
        $treeObj=new Tree(array('id','parentid','categoryname'));
        $cateTree = $treeObj->getTree($result);
        $this->assign('categorys',$cateTree);
        $this->display();
        
    }

    public function add(){
    	$result=$this->dao->select();
    	import('ORG.Util.Tree');
    	$treeObj=new Tree(array('id','parentid','categoryname'));
    	$cateTree = $treeObj->getTree($result);
    	$this->assign('categorys',$cateTree);
    	$this->display();
    } 
    public function insert(){

    }
    public function edit(){
        $id=$_GET['id'];
        $condition['id']=intval($id);
        $result=$this->dao->where($condition)->select();
        $this->display();
    }

}
?>